package amdocs.jet.pm.xml;

import java.util.ArrayList;

import amdocs.jet.pm.Constants;
import amdocs.jet.pm.Utils;

public class AllCurrencies 
{	
	private ArrayList<Currency> currencies = new ArrayList<Currency>();
	private String lastUpdate;
	private String error1;
	private String error2;
	private String error3;
	private String requestedDate;
	
	public ArrayList<Currency> getCurrencies() {
		return currencies;
	}
	public void setCurrencies(ArrayList<Currency> currencies) {
		this.currencies = currencies;
	}
	public String getLastUpdate() {
		return lastUpdate;
	}
	public String getFormatLastUpdate() {
		return Utils.formatDate(lastUpdate, Constants.ISRAEL_BANK_LAST_UPDATE_FORMAT_PATTERN, null);
	}
	public void setLastUpdate(String lastUpdate) {
		this.lastUpdate = lastUpdate;
	}
	public String getError1() {
		return error1;
	}
	public void setError1(String error1) {
		this.error1 = error1;
	}
	public String getError2() {
		return error2;
	}
	public void setError2(String error2) {
		this.error2 = error2;
	}
	public String getError3() {
		return error3;
	}
	public void setError3(String error3) {
		this.error3 = error3;
	}
	public String getRequestedDate() {
		return requestedDate;
	}
	public String getFormatRequestedDate() 
	{
		return Utils.formatDate(requestedDate, Constants.ISRAEL_BANK_REQUESTED_DATE_FORMAT_PATTERN ,null);
	}
	public void setRequestedDate(String requested_date) {
		this.requestedDate = requested_date;
	} 
	public void addCurrency(Currency currency) {
		this.currencies.add(currency);
	}
	public String getCurrencyDate()
	{
		if (lastUpdate != null)
		{
			return getFormatLastUpdate();
		}
		else
		{
			return getFormatRequestedDate();
		}
	}
}
